package org.cbg.control;

import org.cbg.bean.SearchOrderResultBean;
import org.cbg.frame.TrslationMainJframe;
import org.cbg.panel.TraslationMyMainCardJpanel;
import org.cbg.until.TraslationTableMyorderUntil;
import org.come.action.FromServerAction;
import org.come.until.GsonUtil;

/**
 * 藏宝阁我的藏宝阁之我的订单类回调
 * 
 * @author Administrator
 * 
 */
public class SearchMyOrderResultControl implements FromServerAction {

    @Override
    public void controlMessFromServer(String mes, String type) {
        // TODO Auto-generated method stub

        // 消息处理部分(转换为对应的类)
        SearchOrderResultBean sa = GsonUtil.getGsonUtil().getgson().fromJson(mes, SearchOrderResultBean.class);

        /**
         * 传递数据
         */
        TraslationMyMainCardJpanel traslationMyMainCardJpanel = TrslationMainJframe.getTrslationMainJframe().getTrslationMainJpanel().getTranslationMainCardJpanel().getTraslationMyMainJpanel().getTraslationMyMainCardJpanel();
        TraslationTableMyorderUntil.TableModel(traslationMyMainCardJpanel.getTraslationMyMainMyorderJpanel()
                .getjScrollPane(), sa.getRoleorders());
        /**
         * 设置最大的页码
         */
        traslationMyMainCardJpanel.getTraslationMyMainMyorderJpanel()
                .setPage(sa.getTotal() == 0 ? 1 : sa.getTotal());

        /**
         * 展示我的订单面板
         */
        traslationMyMainCardJpanel.getCardLayout()
                .show(traslationMyMainCardJpanel, "myorder");

    }
}
